import { bg_image } from "./indoorConfig.js";
import {getMerchantInfo} from "../api/home/index.js"
export default {
	data() {
		return {
			showOverlay:false,
			bg_image,
			money: null,
			query:{
				merchantCouponType: null,//商家优惠券类型 1.满减券 2.全免券
				couponMoney: null,
				merchantId: null,
				path: 'https://indoor.ipark.vip',
			},
			data:{}
		}
	},
	onReady() {
		this.getDetail()
	},
	onPullDownRefresh(){//页面下拉刷新
		this.getDetail()
		uni.stopPullDownRefresh();
	},
	methods: {
		async fetchSomething(query){
			this.getDetail()
		},
		async getDetail(){
			let res = await getMerchantInfo()
			this.data=res.data||{}
			this.query.merchantId = res.data.id
		},
		open(val) {
			this.showOverlay = true
			this.query.merchantCouponType=val
		},
		showQrCode(url,type) {
			this.query.merchantCouponType=type
			uni.navigateTo({
				url:`${url}?params=${JSON.stringify(this.query)}`
			})
			this.showOverlay = false
		},
		sendUser(url){
			uni.navigateTo({
				url:`${url}?params=${JSON.stringify(this.query)}&appoint=1`
			})
			this.showOverlay = false
		},
	}
}